<#include "../common/header.htm">
<style type="text/css">
	.detail-step-box li{
		width:20%;
	}
</style>
<div class="content-wrapper">
	<section class="content-header">
		<ol class="breadcrumb">
			<li><a href="${ctx}/">首页</a></li>
			<li class="active"><a href="${ctx}${url!}">${title!}</a></li>
			<li class="active"><a href="#">反馈详情</a></li>
		</ol>
		<#if problemFeedBackRecord.feedbackState == 200 && url?? && (url == "/feedbacklist/noreceive" || url == "/feedbacklist/nodeal" ) >
 			<a href="javascript:void(0)" class="btn-commit" onclick="feedback.todeal('${problemFeedBack.id}', '${problemFeedBackRecord.id}','${problemFeedBackRecord.tag}','${problemFeedBack.title}')">处理</a>
		</#if> 
		<#if problemFeedBackRecord.feedbackState == 100 && url?? && (url == "/feedbacklist/noreceive" || url == "/feedbacklist/nodeal" ) >
			<a href="javascript:void(0)" class="btn-commit" onclick="feedback.toreceive('${problemFeedBack.id}', '${problemFeedBackRecord.id}','${problemFeedBack.title!}')">接收</a>
		</#if>
		<a class="btn-return" href="javascript:history.back(-1);">返回</a>
	</section>
	
	<section class="content">
		<ul class="detail-step-box">
           <li class=" <#if problemFeedBackRecord.tag gte 1 && problemFeedBack.feedbackState!=300>current</#if>">
		      <span class="name">提交</span>
		      <span class="link"></span>
	       </li>
	       <li class="<#if problemFeedBackRecord.tag gte 2 && problemFeedBack.feedbackState!=300>current</#if>">
		      <span class="name">确认</span>
		      <span class="link"></span>
	       </li>
	       <li class="<#if problemFeedBackRecord.tag gte 3 && problemFeedBack.feedbackState!=300>current</#if>">
		      <span class="name">处理中</span>
		      <span class="link"></span>
	       </li>
	       <li class="<#if problemFeedBackRecord.tag gte 4 && problemFeedBack.feedbackState!=300>current</#if>">
		      <span class="name">完成</span>
		      <span class="link"></span>
	       </li>
	       <li class="<#if problemFeedBackRecord.tag gte 5 && problemFeedBack.feedbackState!=300>current</#if>">
		      <span class="name">结束</span>
	       </li>
		</ul>
		<div class="detail-info-box">
	        <h4>基本信息：</h4>
			<div class="form-group form-inline">
			    <div class="col-sm-6">
					<label class="input_text">标题：</label> 
					<span class="info">${problemFeedBack.title!}</span>
				</div>
				<div class="col-sm-6">
					<label class="input_text">编号：</label> 
					<span class="info">${problemFeedBack.problemFeedBackNo!}</span>
				</div> 
			</div>
			<div class="form-group form-inline">
			    <div class="col-sm-6">
					<label class="input_text">类型：</label> 
					<span class="info">${feedBackTypeMap["${problemFeedBack.feedbackType}"]!}</span>
				</div>
				<div class="col-sm-6">
					<label class="input_text">进度：</label> 
					<span class="info">${tagMap["${problemFeedBackRecord.tag}"]!}</span>
				</div> 
			</div>
			<div class="form-group form-inline">
			    <div class="col-sm-6">
					<label class="input_text">提交人：</label>
					<span class="info">${problemFeedBack.submiterName!}</span> 
				</div>
				<div class="col-sm-6">
					<label class="input_text">提交时间：</label>
					<span class="info">${problemFeedBack.createrTime!}</span>
				</div> 
			</div>
			<div class="form-group form-inline">
			    <div class="col-sm-6">
					<label class="input_text">客户经理：</label>
					<span class="info">${problemFeedBack.customerManager!}</span>
				</div>
			</div>
			<div class="form-group form-inline">
				<div class="col-sm-6">
					<label class="input_text">当前经办人：</label>
					<span class="info"><@mymacro.firstNotEmpty problemFeedBackRecord.receiverName! problemFeedBackRecord.receiverGroupName!></@mymacro.firstNotEmpty></span>
				</div>
			</div>
			<div class="form-group form-inline">
				<div class="col-sm-12">
					<label class="input_text">参与人：</label>
					<span class="info" title="${participantNames!}">
						${participantNames!}
					</span>
				</div>
			</div> 
			<div class="form-group form-inline">
				<div class="col-sm-12">
					<label class="input_text">备注：</label>
					<span class="info" title="${problemFeedBack.remark!}">${problemFeedBack.remark!}</span> 
				</div>
			</div>
			<div class="form-group form-inline special">
				<div class="col-sm-12">
					<label class="input_text">附件：</label>
					<#list attachFile as map>
			        	<a href="javascript:void(0)" class="info" onclick="feedback.download('${map['fileUrl']!}')">${map['fileName']!}</a> 
					</#list>
				</div>
			</div>
		</div>
		<div class="detail-process-wrapper">
			<div class="title-box">
				<span>处理流程</span>
			</div>
			<!--end .title-box-->
			<ul class="detail-process-box">
		      <#list recordsmap as map>
		      		<li class="current-step">
						<div class="title">
							<span class="bold" style="float: left;">${tagMap["${map['tag']!}"]!}</span>
							<span class="time">${map['time']!}</span>
							<span class="record_state"><@mymacro.firstNotEmpty map['dealUser']! map['dealGroup']!></@mymacro.firstNotEmpty></span>
							<a class="comment" href="javascript:void(0)" onclick="feedback.comment(${map['feedBackRecordId']!},${problemFeedBack.id!},${problemFeedBackRecord.id!},'${title!}')">评论</a>
						</div>
						<#list map?keys as itemKey>
							 <#if itemKey="remark">
							     <#if map[itemKey]??>
							       <div class="txt-box">备注：${map[itemKey]!}</div>
							     </#if>
			                 </#if>
		                </#list>
		                <#if (map.attachs)??&&(map.attachs?size>0)>
		                	<div class="doct-box">
		                		<div class="title">附件：</div>
					         	<span class="record_attach">
							        <#list map.attachs as a>
							        	<a  href="${a.fileUrl}">${a.fileName}&nbsp;&nbsp;<i class="fa fa-download"></i></a>
							    	</#list>
						        </span>
					        </div>
				        </#if>
		                <#list map?keys as itemKey>
		                   <#if itemKey="commentList">
			                    <#if map[itemKey]?exists>  
					                <#list map[itemKey] as comment>   
					                   <div class="comment-info-box">
					                	   <span class="info">评论内容：${comment.content!}</span>
					                	   <div class="time-box">
					                	       <span class="time txt-gray">${comment.commentTime!}</span>
					                	       <span class="txt-gray">评论人：${comment.commentUserName!}</span>
					                	   </div>
					                  </div>  
					                </#list>  
					            </#if> 
		                    </#if>
		                </#list>
					</li>
				</#list>
			</ul>
		</div>
	</section>
</div>
<script type="text/javascript">

var is_submit=false;

var feedback = {
	comment : function(feedBackRecordId, problemFeedBackID, deatilFeedBackRecordId, headTitle) {
		if(is_submit){
			return;
		}
		is_submit=true;
		var title ="评论";
		var j = 0;
		base.getView({
			url:"${ctx}/feedBack/tocomment?feedBackRecordId="+feedBackRecordId+"&problemFeedBackID="+problemFeedBackID+"&deatilFeedBackRecordId="+deatilFeedBackRecordId+"&headTitle="+headTitle,
			success:function(result){
				bootbox.dialog({
					title:title,
					message:result,
					size:"large",
					closeButton : false,
					buttons:{
						cancel:{
							label:"取消",
							className:"btn btn-secondary",
							callback:function(){
								is_submit=false;
							}
						},
						sure:{
							label:"确定",
							className:"btn btn-primary",
							callback:function(){
								if (j != 0) {
									is_submit=false;
									return ;
								}
								j++;
								var $dialogObj = $("#comment");
								if ($dialogObj.valid()) {
									$dialogObj.submit();
								} else {
									j = 0;
								}
								return false;
							}
						}
					}
				})
			}
		});
	},
	toreceive : function(feedBackId, feedBackRecordId, wtitle) {
		if(is_submit){
			return;
		}
		is_submit=true;
		var title ="反馈接收";
		var j = 0;
		base.getView({
			url:"${ctx}/feedBack/toreceive?feedBackId="+feedBackId+"&feedBackRecordId="+feedBackRecordId+"&wtitle="+wtitle,
			success:function(result){
				bootbox.dialog({
					title:title,
					message:result,
					size:"large",
					closeButton : false,
					buttons:{
						cancel:{
							label:"取消",
							className:"btn btn-secondary",
							callback:function() {
								is_submit=false;
							}
						},
						sure:{
							label:"确定",
							className:"btn btn-primary",
							callback:function(){
								if (j != 0) {
									is_submit=false;
									return ;
								}
								j++;
								var $dialogObj = $("#receive");
								if ($dialogObj.valid()) {
									$dialogObj.submit();
								} else {
									j = 0;
								}
								return false;
							}
						}
					}
				})
			}
		});
	},
	todeal : function(id, feedBackRecordId, tag, wtitle) {
		if(is_submit){
			return;
		}
		is_submit=true;
		var title ="反馈处理";
		var j = 0;
		base.getView({
			url:"${ctx}/feedBack/tohandle?feedBackId="+id+"&feedBackRecordId="+feedBackRecordId+"&tag="+tag+"&wtitle="+wtitle,
			success:function(result){
				bootbox.dialog({
					title:title,
					message:result,
					size:"large",
					closeButton : false,
					buttons:{
						cancel:{
							label:"取消",
							className:"btn btn-secondary",
							callback:function() {
								is_submit=false;
							}
						},
						sure:{
							label:"确定",
							className:"btn btn-primary",
							callback:function(){
								if (j != 0) {
									is_submit=false;
									return ;
								}
								j++;
								var $dialogObj = $("#handle");
								if ($dialogObj.valid()) {
									$dialogObj.submit();
								} else {
									j = 0;
								}
								return false;
							}
						}
					}
				})
			}
		});
	},
	//a 标签下载
	download : function(url) {
		window.location.href="${ctx}"+encodeURI(url);
	}
}
</script>
<#include "../common/footer.htm">
